package com.suixuan.spring.entity.security;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;

import org.hibernate.validator.NotEmpty;

import com.suixuan.spring.entity.base.BaseLongEntityBean;

/**
 * 
 * @Title: Users.java
 * @Package com.suixuan.spring.entity.security
 * @Description: 用户实体类
 * @author suixuan
 * @date 2010-11-5 下午02:07:20
 * @version V1.0
 */
@Entity
@Table(name = "_security_users")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
public class Users extends BaseLongEntityBean {

	/**
	 * 
	 */
	private static final long serialVersionUID = 5447157484360504243L;
	/**
	 * 用户名
	 */
	private String username;
	/**
	 * 密码
	 */
	private String password;
	/**
	 * 用户是否启用
	 */
	private boolean enabled = true;
	/**
	 * 用户是否可修改
	 */
	private boolean modify = true;

	/**
	 * 限制登陆Ip
	 */
	private String limitLoginIp;

	@Column(name = "_username", unique = true)
	// @Length(min = 6, max = 12)
	@NotEmpty
	public String getUsername() {
		return username;
	}

	@Column(name = "_password")
	// @Length(min = 6, max = 32)
	@NotEmpty
	public String getPassword() {
		return password;
	}

	@Column(name = "_enabled")
	public boolean isEnabled() {
		return enabled;
	}

	@Column(name = "_modify")
	public boolean isModify() {
		return modify;
	}

	@Column(name = "_limit_login_ip")
	public String getLimitLoginIp() {
		return limitLoginIp;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public void setEnabled(boolean enabled) {
		this.enabled = enabled;
	}

	public void setModify(boolean modify) {
		this.modify = modify;
	}

	public void setLimitLoginIp(String limitLoginIp) {
		this.limitLoginIp = limitLoginIp;
	}

	public Users() {
		super();
	}

	public Users(String username, String password, boolean enabled, boolean modify) {
		super();
		this.username = username;
		this.password = password;
		this.enabled = enabled;
		this.modify = modify;
	}

	public Users(String username, String password) {
		super();
		this.username = username;
		this.password = password;
	}

	public Users(String username, String password, boolean enabled) {
		super();
		this.username = username;
		this.password = password;
		this.enabled = enabled;
	}

	public Users(Long id, String username) {
		super();
		this.id = id;
		this.username = username;
	}

}
